import request from '@/utils/request'

export function add(data) {
  return request({
    url: 'api/dullMaintenanceConfig',
    method: 'post',
    data
  })
}

export function del(ids) {
  return request({
    url: 'api/dullMaintenanceConfig/',
    method: 'delete',
    data: ids
  })
}

export function edit(data) {
  return request({
    url: 'api/dullMaintenanceConfig',
    method: 'put',
    data
  })
}

export function uploadFileAPI(data) {
  return request({
    url: `api/dullMaintenanceConfig/importExcel?ruleType=${data.ruleType}`,
    method: 'post',
    data: data.formData,
    headers: {
      'Content-Type': 'multipart/form-data'
    }
  })
}

export function downloadFileAPI(data) {
  return request({
    url: `api/dullMaintenanceConfig/downloadTemplate?ruleType=${data}`,
    method: 'get',
    data,
    responseType: 'blob'
  })
}

export default { add, edit, del, uploadFileAPI, downloadFileAPI }
